{% extends "sentry/bases/modal.html" %}

{% load i18n %}

{% block title %}{% trans "Organization Invite" %} | {{ block.super }}{% endblock %}

{% block page_header_block %}{% endblock %}
{% block bodyclass %}{% endblock %}

{% block main %}
  <section class="body">
    <div class="row">
      <div class="span7">
        <div class="page-header">
          <h2>{% trans "Organization Invite" %}</h2>
        </div>

        <p style="font-size: 1.3em;">
          {% blocktrans with org_name=organization.name %}<strong>{{ org_name }}</strong> is using Sentry to aggregate errors.{% endblocktrans %}
        </p>

        {% if existing_member %}
          <div class="alert alert-block">
            <p>Your account (<strong>{{ request.user.username }}</strong>) is already a member of this organization.</p>

            <p>Did you want to <a href="{{ logout_url }}">switch accounts</a>?</p>
          </div>
        {% endif %}

        {% if project_count %}
          <p>{% blocktrans %}You have been invited to join this organization, which manages <strong>{{ project_count }}</strong> project(s), including:{% endblocktrans %}</p>
          <ul>
            {% for project in project_list|slice:"5" %}
              <li>
                {{ project.slug }}
              </li>
            {% endfor %}
          </ul>
        {% else %}
          <p>{% blocktrans %}You have been invited to join this organization.{% endblocktrans %}</p>
        {% endif %}

        {% if needs_authentication %}
          <p>{% trans "To continue, you must either login to your existing account, or create a new one." %}</p>

          <fieldset class="form-actions">
            <div class="pull-right" style="margin-top: 5px;">
              <a href="{{ login_url }}">{% trans "Login as an existing user" %}</a>
            </div>
            <a href="{{ register_url }}" class="btn btn-primary">{% trans "Create a new account" %}</a>
          </fieldset>
        {% else %}
          <form method="POST">
            {% csrf_token %}
            <p>
              <button type="submit" class="btn btn-primary">
                {% blocktrans with org_name=organization.name %}Join the {{ org_name }} organization{% endblocktrans %}
              </button>
            </p>
          </form>
        {% endif %}
      </div>
    </div>
  </section>
{% endblock %}
